<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div></div>
</body>
</html>
<script>

const people = [
      { name: 'Wes', year: 1988 },
      { name: 'Kait', year: 1986 },
      { name: 'Irv', year: 1970 },
      { name: 'Lux', year: 2015 }
    ];
  
    /*
    1. 是否有人超过 19 岁？
    2. 是否所有人都是成年人？
    */
    const isAdult = people.some(person => { return (new Date()).getFullYear() - person.year >= 19 })
    console.log('isAdult', isAdult);

    const allAdult = people.every(person => { return (new Date()).getFullYear() - person.year >= 19 })
    console.log('allAdult', allAdult);

    const comments = [
      { text: 'Love this!', id: 523423 },
      { text: 'Super good', id: 823423 },
      { text: 'You are the best', id: 2039842 },
      { text: 'Ramen is my fav food ever', id: 123523 },
      { text: 'Nice Nice Nice!', id: 542328 }
    ];

    
    //找到 ID 号为 823423 的评论
    const comment = comments.find(comment => comment.id == 823423);
    
    const index = comments.findIndex(comment => comment.id == 823423);
    console.log(comment,index)    //{text: "Super good", id: 823423}  1

    // 删除 ID 号为 823423 的评论
    const newComments = [
      ...comments.slice(0, index),
      ...comments.slice(index + 1)
    ];
    console.table(newComments)

</script>